<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Class: Sass::Script::Operation</title>
<link rel="stylesheet" href="style.css" tppabs="http://sass-lang.com/docs/yardoc/css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="common.css" tppabs="http://sass-lang.com/docs/yardoc/css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '../..';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="jquery.js" tppabs="http://sass-lang.com/docs/yardoc/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js" tppabs="http://sass-lang.com/docs/yardoc/js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" tppabs="http://sass-lang.com/docs/yardoc/_index.html">Index (O)</a> &raquo; 
    <span class='title'><a href="Sass-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass.html" title="Sass (module)">Sass</a></span> &raquo; <span class='title'><a href="Script.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script.html" title="Sass::Script (module)">Script</a></span>
     &raquo; 
    <span class="title">Operation</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="javascript:if(confirm(%27http://sass-lang.com/docs/yardoc/Sass/Script/.  \n\nThis file was not retrieved by Teleport Pro, because the server reports that this file cannot be found.  \n\nDo you want to open it from the server?%27))window.location=%27http://sass-lang.com/docs/yardoc/Sass/Script/.%27" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Sass::Script::Operation 
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName"><a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a></li>
          
            <li class="next">Sass::Script::Operation</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">/var/www/sass-pages/.sass/lib/sass/script/operation.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>A SassScript parse node representing a binary operation, such as <code>$a + $b</code> or <code>&quot;foo&quot; + 1</code>.</p>

  </div>
</div>
<div class="tags">
  
</div>

  
  
  
  
  <h2>Instance Attribute Summary</h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#operand1-instance_method" title="#operand1 (instance method)">- <strong>operand1</strong> </a>
    

    
  </span>
  
  
    <span class="note title readonly">readonly</span>
    
  
  
  
  

  
    <span class="summary_desc">Returns the value of attribute operand1.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#operand2-instance_method" title="#operand2 (instance method)">- <strong>operand2</strong> </a>
    

    
  </span>
  
  
    <span class="note title readonly">readonly</span>
    
  
  
  
  

  
    <span class="summary_desc">Returns the value of attribute operand2.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#operator-instance_method" title="#operator (instance method)">- <strong>operator</strong> </a>
    

    
  </span>
  
  
    <span class="note title readonly">readonly</span>
    
  
  
  
  

  
    <span class="summary_desc">Returns the value of attribute operator.</span>
  
</li>

    
  </ul>


  <h2>Instance Method Summary</h2>

  <ul class="summary">
    
      <li class="protected ">
  <span class="summary_signature">
    
      <a href="#_perform-instance_method" title="#_perform (instance method)">- (Literal) <strong>_perform</strong>(environment) </a>
    

    
  </span>
  
  
  <span class="note title protected">protected</span>
  
  

  
    <span class="summary_desc">Evaluates the operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#children-instance_method" title="#children (instance method)">- (Array&lt;Node&gt;) <strong>children</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns the operands for this operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#deep_copy-instance_method" title="#deep_copy (instance method)">- <strong>deep_copy</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc"></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Operation) <strong>initialize</strong>(operand1, operand2, operator) </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  

  
    <span class="summary_desc">A new instance of Operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#inspect-instance_method" title="#inspect (instance method)">- (String) <strong>inspect</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">A human-readable s-expression representation of the operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_sass-instance_method" title="#to_sass (instance method)">- <strong>to_sass</strong>(opts = {}) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc"></span>
  
</li>

    
  </ul>

  
  
  
  
  
  <h3 class="inherited">Methods inherited from <a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a></h3>
  <p class="inherited"><a href="Node-1.html#dasherize-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#dasherize-instance_method" title="Sass::Script::Node#dasherize (method)">#dasherize</a>, <a href="Node-1.html#opts-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#opts-instance_method" title="Sass::Script::Node#opts (method)">#opts</a>, <a href="Node-1.html#perform-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#perform-instance_method" title="Sass::Script::Node#perform (method)">#perform</a></p>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Operation (class)">Operation</a></tt>) <strong>initialize</strong>(operand1, operand2, operator) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>A new instance of Operation</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Script::Node</a></tt>)</span>
      
      
        <span class='name'>operand1</span>
      
      
      
        &mdash;
        The parse-tree node for the right-hand side of the operator
      
    </li>
  
    <li>
      
        <span class='type'>(<tt><a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Script::Node</a></tt>)</span>
      
      
        <span class='name'>operand2</span>
      
      
      
        &mdash;
        The parse-tree node for the left-hand side of the operator
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>Symbol</tt>)</span>
      
      
        <span class='name'>operator</span>
      
      
      
        &mdash;
        The operator to perform. This should be one of the binary operator names in <tt><a href="Lexer.html#OPERATORS-constant" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Lexer.html#OPERATORS-constant" title="Sass::Script::Lexer::OPERATORS (constant)">Lexer::OPERATORS</a></tt>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


24
25
26
27
28
29</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 24</span>

def initialize(operand1, operand2, operator)
  @operand1 = operand1
  @operand2 = operand2
  @operator = operator
  super()
end</pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <span id="operand1-instance_method"></span>
      <div class="method_details first">
  <p class="signature first" id="operand1-instance_method">
  
    - <strong>operand1</strong>  <span class="extras">(readonly)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute operand1</p>

  </div>
</div>
<div class="tags">
  
</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


14
15
16</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 14</span>

def operand1
  @operand1
end</pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <span id="operand2-instance_method"></span>
      <div class="method_details ">
  <p class="signature " id="operand2-instance_method">
  
    - <strong>operand2</strong>  <span class="extras">(readonly)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute operand2</p>

  </div>
</div>
<div class="tags">
  
</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 15</span>

def operand2
  @operand2
end</pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <span id="operator-instance_method"></span>
      <div class="method_details ">
  <p class="signature " id="operator-instance_method">
  
    - <strong>operator</strong>  <span class="extras">(readonly)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute operator</p>

  </div>
</div>
<div class="tags">
  
</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


16
17
18</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 16</span>

def operator
  @operator
end</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="_perform-instance_method">
  
    - (<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>) <strong>_perform</strong>(environment)  <span class="extras">(protected)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Evaluates the operation.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Environment.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Environment.html" title="Sass::Environment (class)">Sass::Environment</a></tt>)</span>
      
      
        <span class='name'>environment</span>
      
      
      
        &mdash;
        The environment in which to evaluate the SassScript
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>)</span>
      
      
      
      
        &mdash;
        The SassScript object that is the value of the operation
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if the operation is undefined for the operands
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 73</span>

def _perform(environment)
  literal1 = @operand1.perform(environment)

  # Special-case :and and :or to support short-circuiting.
  if @operator == :and
    return literal1.to_bool ? @operand2.perform(environment) : literal1
  elsif @operator == :or
    return literal1.to_bool ? literal1 : @operand2.perform(environment)
  end

  literal2 = @operand2.perform(environment)

  if (literal1.is_a?(Null) || literal2.is_a?(Null)) && @operator != :eq && @operator != :neq
    raise Sass::SyntaxError.new("Invalid null operation: \"#{literal1.inspect} #{@operator} #{literal2.inspect}\".")
  end

  begin
    opts(literal1.send(@operator, literal2))
  rescue NoMethodError => e
    raise e unless e.name.to_s == @operator.to_s
    raise Sass::SyntaxError.new("Undefined operation: \"#{literal1} #{@operator} #{literal2}\".")
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="children-instance_method">
  
    - (<tt>Array&lt;<a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a>&gt;</tt>) <strong>children</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the operands for this operation.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Array&lt;<a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a>&gt;</tt>)</span>
      
      
      
      
    </li>
  
</ul>

  <h3>See Also:</h3>
  <ul class="see">
    
      <li><a href="Node-1.html#children-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#children-instance_method" title="Sass::Script::Node#children (method)">Node#children</a></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 54</span>

def children
  [@operand1, @operand2]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="deep_copy-instance_method">
  
    - <strong>deep_copy</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
  <h3>See Also:</h3>
  <ul class="see">
    
      <li><a href="Node-1.html#deep_copy-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#deep_copy-instance_method" title="Sass::Script::Node#deep_copy (method)">Node#deep_copy</a></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


59
60
61
62
63
64</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 59</span>

def deep_copy
  node = dup
  node.instance_variable_set('@operand1', @operand1.deep_copy)
  node.instance_variable_set('@operand2', @operand2.deep_copy)
  node
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="inspect-instance_method">
  
    - (<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>) <strong>inspect</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>A human-readable s-expression representation of the operation</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>)</span>
      
      
      
      
        &mdash;
        A human-readable s-expression representation of the operation
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 32</span>

def inspect
  "(#{@operator.inspect} #{@operand1.inspect} #{@operand2.inspect})"
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_sass-instance_method">
  
    - <strong>to_sass</strong>(opts = {}) 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
  <h3>See Also:</h3>
  <ul class="see">
    
      <li><a href="Node-1.html#to_sass-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#to_sass-instance_method" title="Sass::Script::Node#to_sass (method)">Node#to_sass</a></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39
40
41
42
43
44
45
46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/operation.rb', line 37</span>

def to_sass(opts = {})
  pred = Sass::Script::Parser.precedence_of(@operator)
  o1 = operand_to_sass @operand1, :left, opts
  o2 = operand_to_sass @operand2, :right, opts
  sep =
    case @operator
    when :comma; ", "
    when :space; " "
    else; " #{Lexer::OPERATORS_REVERSE[@operator]} "
    end
  "#{o1}#{sep}#{o2}"
end</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Fri Mar  8 20:33:45 2013 by 
  <a href="javascript:if(confirm(%27http://yardoc.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://yardoc.org/%27" tppabs="http://yardoc.org/" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.7).
</div>


  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("UA-535380-8");
  pageTracker._trackPageview();
  } catch(err) {}</script>


  </body>
</html>